// "Copyright [2021] <Copyright Shengkai Lin>"

#ifndef CLUSTER_DISPATCHER_FLOWPARSER_H_
#define CLUSTER_DISPATCHER_FLOWPARSER_H_

#include <vector>
#include <map>
#include <string>

namespace ai_sim {

class FormalCompoundIdx {
 public:
    int level;
    std::string modname;
    int index;
    int modid;
    int outpathidx;
    explicit FormalCompoundIdx(
        std::string str, std::map<int, std::string> levelnedmap);
};

class DetailFlow {
 public:
    double time;
    int data_size;
    std::vector<FormalCompoundIdx> flow_path;

 public:
    DetailFlow() {
        time = -1;
        data_size = -1;
        flow_path.clear();
    }
    DetailFlow(double time_, int data_size_,
        std::vector<FormalCompoundIdx> flow_path_) {
        time = time_;
        data_size = data_size_;
        flow_path = flow_path_;
    }
};

class FlowParser {
 private:
    std::map<int, std::string> levelnedmap;
    std::string file_path;
    std::vector<DetailFlow> flows;
    int current_flow_pos;
    DetailFlow errflow;
 public:
    explicit FlowParser(std::string file_path);
    DetailFlow getCurrentFlow();
    DetailFlow getNextFlow();
};

}  // namespace ai_sim

#endif  // CLUSTER_DISPATCHER_FLOWPARSER_H_
